<%--
  Created by IntelliJ IDEA.
  User: zhengshuai
  Date: 2020/1/14
  Time: 3:56 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Result</title>
    <style>
        #class td /*设置表格文字左右和上下居中对齐*/
        {
            vertical-align: middle;
            text-align: center;
        }
    </style>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <%--menubar2--%>
    <nav class="navbar navbar-expand-sm navbar-light bg-light mb-3">
        <div class="container">
            <a class="navbar-brand" href="/home">Home</a>
            <ul class="navbar-nav collapse navbar-collapse">
                <li class="nav-item">
                    <a class="nav-link" href="/create">create Product</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/showProd">show Product</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/login">Login</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Logout</a>
                </li>
            </ul>
            <%--search--%>
            <form action="searchProd" method="post" class="form-inline my-2 my-lg-0">
                <input name="productName" class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
                <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
            </form>
        </div>
    </nav>
</head>
<body>


<%--table--%>
<div class="container">
    <table class="table table-striped">
    <thead>
    <tr>
        <th>#</th>
        <th>Name</th>
        <th>Description</th>
        <th>Price</th>
        <th>Image</th>
        <th>Method</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${searchedList}" var="product">
        <tr>
            <th align="center">${product.id}</th>
            <th align="center">${product.name}</th>
            <th align="center">${product.description}</th>
            <th align="center">${product.price}</th>
            <th align="center">${product.image}</th>
            <th>
                <button class="btn btn-outline-danger btn-sm" type="submit"><a href="deleteProd?id=${product.id}">delete</a></button>
                <button class="btn btn-outline-primary btn-sm" type="submit"><a href="updateProd?id=${product.id}">update</a></button>
            </th>
        </tr>
    </c:forEach>
    </tbody>
</table>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
